package com.jd.system.service.impl;

import com.jd.basic.util.PageList;
import com.jd.system.domain.Dictionarytype;
import com.jd.system.mapper.DictionarytypeMapper;
import com.jd.system.query.DictionarytypeQuery;
import com.jd.system.service.IDictionarytypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class DictionarytypeServiceImpl implements IDictionarytypeService {

    @Autowired
    private DictionarytypeMapper dictionarytypeMapper;


    @Override
    @Transactional
    public void save(Dictionarytype dictionarytype) {
        dictionarytypeMapper.save(dictionarytype);
    }

    @Override
    @Transactional
    public void remove(Long id) {
        dictionarytypeMapper.remove(id);
    }

    @Override
    @Transactional
    public void update(Dictionarytype dictionarytype) {
        dictionarytypeMapper.update(dictionarytype);
    }

    @Override
    public Dictionarytype loadById(Long id) {
        return dictionarytypeMapper.loadById(id);
    }

    @Override
    public List<Dictionarytype> loadAll() {
        return dictionarytypeMapper.loadAll();
    }

    @Override
    public PageList<Dictionarytype> queryPage(DictionarytypeQuery dictionarytypeQuery) {
        // 查询总条数
        Integer totals = dictionarytypeMapper.queryPage(dictionarytypeQuery);
        if (totals == 0){
            return new PageList<>();
        }
        // 分页查询
        List<Dictionarytype> data = dictionarytypeMapper.queryData(dictionarytypeQuery);
        return new PageList<>(data,totals);

    }

    @Override
    public void patchRemove(List<Long> ids) {
        dictionarytypeMapper.patchRemove(ids);
    }


}
